# --- T2-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# 
# T2 SDE: package/.../netpbm/shared_files-fix.patch
# Copyright (C) 2004 - 2006 The T2 SDE Project
# 
# More information can be found in the files COPYING and README.
# 
# This patch file is dual-licensed. It is available under the license the
# patched project is licensed under, as long as it is an OpenSource license
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
# of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
# --- T2-COPYRIGHT-NOTE-END ---
--- netpbm-10.25/buildtools/installnetpbm.pl	2003-11-05 23:35:37.000000000 +0100
+++ netpbm-10.25-t2/buildtools/installnetpbm.pl	2004-10-18 17:46:15.739386208 +0200
@@ -146,13 +146,12 @@
 
     if (`cp --version 2>/dev/null` =~ m/GNU/) {
         # It's GNU Cp -- we have options galore, and they're readable.
-        $cpCommand = "cp --recursive --preserve --no-dereference";
+        $cpCommand = "cp --preserve --no-dereference";
     } else {
         # This works on Cp from "4th Berkeley Distribution", July 1994.
         # Mac OSX has this.
-        # -R means recursive with no dereferencing of symlinks
         # -p means preserve attributes
-        $cpCommand = "cp -R -p";
+        $cpCommand = "cp -p -d";
     }
     return($cpCommand);
 }
@@ -734,6 +733,28 @@
 
 
 
+sub installManPages($$) {
+   
+    my ($srcdir, $dstdir) = @_;
+    
+    if (! -d ($dstdir)) {
+	my $succeeded = mkdir($dstdir, 0777);
+	
+	if (!$succeeded) {
+	    print("Unable to create directory '$dstdir'.  " .
+		  "Error=$ERRNO\n");
+	    return;
+	} 
+    }
+    
+    my $rc = system("$cpCommand $srcdir/* $dstdir/");
+    
+    if ($rc != 0) {
+	print("copy of man pages from $srcdir to $dstdir failed.\n");
+	print("cp exit code is $rc\n");
+    }
+}
+
 sub installManPage($$$) {
 
 
@@ -745,16 +766,11 @@
 
     print("Installing man pages...\n");
 
-    my $rc = system("$cpCommand $pkgdir/man/* $manDir/");
+    installManPages("$pkgdir/man/man1", "$manDir/man1");
+    installManPages("$pkgdir/man/man3", "$manDir/man3");
+    installManPages("$pkgdir/man/man5", "$manDir/man5");
 
-    if ($rc != 0) {
-        print("copy of man pages from $pkgdir/man to $manDir failed.\n");
-        print("cp exit code is $rc\n");
-    } else {
-        print("done.\n");
-    }
-
-    print("\n");
+    print("done\n");
 
     removeObsoleteManPage($manDir);
 
